import Vue from 'vue';

//引入路由
import VueRouter from 'vue-router'
//注册路由
Vue.use(VueRouter)


const routes = [
    {
        path: "/", // 默认hash值路径
        redirect: "/login" // 
    },
    {   //城市定位
        path: '/citysearch',
        component: () => import('../view/citysearch.vue')
    },
    {   //登录
        path: '/login',
        component: () => import('../view/login.vue')
    },
    {  //城市列表
        path: '/cityList',
        component: () => import('../view/cityList.vue')
    },
    {   //商品评价
        path: '/comment',
        component: () => import('../view/comment.vue')
    },
    {   //商品搜索
        path: '/goodsearch',
        component: () => import('../view/goodsearch.vue')
    },
    {  //商品搜索列表
        path: '/goodsearchList',
        component: () => import('../view/goodsearchList.vue')
    },
    {  //商品详情
        path: '/goodproduct',
        component: () => import('../view/goodproduct.vue')
    },
    {  //商铺详情加入购物车
        path: '/goodShoping',
        component: () => import('../view/goodShoping.vue'),
        children: [
            // 商品详情
            {
                path: 'shopinggoods',
                component: () => import('../view/shopinggoods.vue'),
            },
            // 商铺评价
            {
                path: 'goodsEvaluate',
                component: () => import('../view/goodsEvaluate.vue'),
            },
        ]
    },
    // 商家详情
    {
        path: '/goodShoping/particularsShoping',
        component: () => import('../view/particularsShoping.vue'),
    },
    {  //首页
        path: '/index',
        component: () => import('../view/index.vue')
    },
    {   //我的个人中心
        path: '/user',
        component: () => import('../view/user.vue')

    },

    {   //商品类别列表
        path: '/goodList',
        component: () => import('../view/goodList.vue')
    },
    {
        path: '/bottom',
        component: () => import('../view/bottom.vue'),

    },
    {
        path: '/shoppingtrolley',
        component: () => import('../view/shoppingtrolley.vue')
    }, {
        path: '/close',
        component: () => import('../view/close.vue')
    }
    , {
        path: '/selectaddress',
        component: () => import('../view/selectaddress.vue')
    }
    , {
        path: '/Addresstheeditor',
        component: () => import('../view/Addresstheeditor.vue')
    }, {
        path: '/remark',
        component: () => import('../view/remark.vue')

    },
    {   //评价
        path: '/evaluate',
        component: () => import('../view/evaluate.vue')
    },
    {
        path: '/mymoney',
        component: () => import('../view/mymoney.vue')
    },
    {
        path: '/mymoneytwo',
        component: () => import('../view/mymoneytwo.vue')
    },
    {
        path: '/orderList',
        component: () => import('../view/orderList.vue')
    },
    {
        path: '/vip',
        component: () => import('../view/vip.vue')

    },
    {
        path: '/change_information',
        component: () => import('../view/change_information')
    }, {
        path: '/change_password',
        component: () => import('../view/change_password')
    },
    {
        path: '/discounts',
        component: () => import('../view/discounts')
    }
]

//创建路由对象
const router = new VueRouter({
    routes
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
export default router